//-----------------------------------------------------------------------
// <copyright file="LoaiDanhMucServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using APPro.Entities;
using APPro.Data;
    
namespace APPro.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class LoaiDanhMucServiceBase
    {
        #region LoaiDanhMucServiceBase

        public static void CreateLoaiDanhMuc(LoaiDanhMuc loaiDanhMuc)
        {            
            try
            {
                LoaiDanhMucDAO loaiDanhMucDAO = new LoaiDanhMucDAO();
                loaiDanhMucDAO.CreateLoaiDanhMuc(loaiDanhMuc);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreateLoaiDanhMucException, ex);
            }
        }

        public static void UpdateLoaiDanhMuc(LoaiDanhMuc loaiDanhMuc)
        {            
            try
            {
                LoaiDanhMucDAO loaiDanhMucDAO = new LoaiDanhMucDAO();
                loaiDanhMucDAO.UpdateLoaiDanhMuc(loaiDanhMuc);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdateLoaiDanhMucException, ex);
            }
        }        

        public static void DeleteLoaiDanhMuc(int maLoaiDanhMuc)
        {            
            try
            {
                LoaiDanhMucDAO loaiDanhMucDAO = new LoaiDanhMucDAO();
                loaiDanhMucDAO.DeleteLoaiDanhMuc(maLoaiDanhMuc);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeleteLoaiDanhMucException, ex);
            }
        }
		
        public static LoaiDanhMuc GetLoaiDanhMuc(int maLoaiDanhMuc)
        {            
            try
            {
                LoaiDanhMucDAO loaiDanhMucDAO = new LoaiDanhMucDAO();
                return loaiDanhMucDAO.GetLoaiDanhMuc(maLoaiDanhMuc);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetLoaiDanhMucException, ex);
            }
        }                
		
        public static LoaiDanhMucCollection GetLoaiDanhMucList(LoaiDanhMucColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                LoaiDanhMucDAO loaiDanhMucDAO = new LoaiDanhMucDAO();
                return loaiDanhMucDAO.GetLoaiDanhMucList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetLoaiDanhMucListException, ex);
            }
        }        

        public static LoaiDanhMucCollection GetLoaiDanhMucList(LoaiDanhMucColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                LoaiDanhMucDAO loaiDanhMucDAO = new LoaiDanhMucDAO();
                return loaiDanhMucDAO.GetLoaiDanhMucList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetLoaiDanhMucListException, ex);
            }
        }        
		
		
        #endregion
    }
}